package Lesson17.Cars;

public class Car 
{
	protected String model;
	private double maxSpeed;
	protected double currentSpeed;
	protected int currentGear;
	protected int numberOfDoors;
	protected int iDNumber;
	protected boolean isSportCar;
	protected Person owner;
	
	protected String type = "Just a car";
	
	Car(double maxSpeed)
	{
		this.maxSpeed = maxSpeed;
	}
	
	protected void changeOwner(Person newOwner)
	{
		this.owner = newOwner;
	}
	protected void startEngine()
	{
		System.out.println("Engine started!");
	}
	protected void changeGear(int gear)
	{
		if(gear >= 1 && gear < 6)
			currentGear = gear;
		else
			System.out.println("No such a gear available!");
	}
	protected void accelerate(double speed)
	{
		if(speed + currentSpeed > maxSpeed)
			currentSpeed = maxSpeed;
		else
			currentSpeed += speed;
		System.out.println("Now driving at "  + currentSpeed + "km/h.");
	}
	
}
